﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Linq;
using System.Text;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.Windows.Navigation;
using System.Windows.Shapes;
using Tycho.Runtime;

namespace Tycho.Peyote {
    /// <summary>
    /// Interaction logic for GlyphControl.xaml
    /// </summary>
    public class GlyphControl : UserControl, IDependencyNotificationListener, INotifyPropertyChanged {
        public virtual AnyObject RuntimeValue { get; protected set; }
        public virtual GlyphHandle GlyphHandle { get; set; }
        public GlyphRefreshType RefreshType { get; protected set; }
        public virtual void NotifyModifiedDependency (CircularReferenceVigil circularReferenceVigil) {
        }

        private bool InternalInEditMode;
        public virtual bool InEditMode {
            get {
                return InternalInEditMode;
            }
            set {
                InternalInEditMode = value;
                NotifyPropertyChanged ("InEditMode");
            }
        }

        protected void NotifyPropertyChanged (string name) {
            if (PropertyChanged != null) {
                PropertyChanged (this, new PropertyChangedEventArgs ("InEditMode"));
            }
        }

        public event PropertyChangedEventHandler PropertyChanged;

        public virtual void Reevaluate () {
        }
    }

    public enum GlyphRefreshType {
        None,
        Automatic,
        Manual,
    }
}
